from django.shortcuts import render

# Create your views here.
from django.shortcuts import render,redirect,reverse,HttpResponse
from django.views import View
import json

def views_index(request):
    print(request)
    return HttpResponse('小王八')


def axios(request):
    m = request.method
    print(m)
    if m == "GET":
        jo = {
            "posts": [
                {
                    "id": 1,
                    "title": "json-server",
                    "author": "typicode"
                },
                {
                    "id": 2,
                    "title": "json-server2",
                    "author": "typicode2"
                }
            ],
            "comments": [
                {
                    "id": 1,
                    "body": "some comment",
                    "postId": 1
                }
            ],
            "profile": {
                "name": "typicode"
            }
        }
        return HttpResponse(json.dumps(jo))